package com.zbkj.admin.controller.platform.splittingAccount;

import com.github.pagehelper.PageInfo;
import com.zbkj.common.model.splittingAccount.EbCommissionTransaction;
import com.zbkj.common.model.splittingAccount.EbMerchantAccount;
import com.zbkj.common.model.splittingAccount.EbSplitAccount;
import com.zbkj.common.model.splittingAccount.EbWithdrawalApplication;
import com.zbkj.common.request.splittingAccount.SplittingAccountRequest;
import com.zbkj.common.result.CommonResult;
import com.zbkj.service.service.splittingAccount.SplittingAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("api/admin/platform/splittingAccount")
@Api(tags = "分账管理") //配合swagger使用
public class SplittingAccountController {
    @Autowired
    SplittingAccountService splittingAccountService;

    /**
     * 商户账户分页查询
     *
     * @param request 分页请求参数
     * @return 分页结果
     */
    @ApiOperation(value = "商户账户分页查询")
    @PostMapping(value = "/getMerchantAccountPageList")
    public CommonResult<PageInfo<EbMerchantAccount>> getMerchantAccountPageList(@RequestBody SplittingAccountRequest request) {

        return CommonResult.success(splittingAccountService.getMerchantAccountPageList(request));
    }

    /**
     * 商户佣金交易记录分页查询
     *
     * @param request 分页请求参数
     * @return 分页结果
     */
    @PostMapping(value = "/getCommissionTransactionPageList")
    public CommonResult<PageInfo<EbCommissionTransaction>> getCommissionTransactionPageList(@RequestBody SplittingAccountRequest request) {


        return CommonResult.success(splittingAccountService.getCommissionTransactionPageList(request));
    }

    /**
     * 商户分账记录分页查询
     *
     * @param request 分页请求参数
     * @return 分页结果
     */
    @PostMapping(value = "/getSplitAccountPageList")
    public CommonResult<PageInfo<EbSplitAccount>> getSplitAccountPageList(@RequestBody SplittingAccountRequest request) {


        return CommonResult.success(splittingAccountService.getSplitAccountPageList(request));
    }

    /**
     * 商户提现申请分页查询
     *
     * @param request 分页请求参数
     * @return 分页结果
     */
    @PostMapping(value = "/getWithdrawalApplicationPageList")
    public CommonResult<PageInfo<EbWithdrawalApplication>> getWithdrawalApplicationPageList(@RequestBody SplittingAccountRequest request) {

        return CommonResult.success(splittingAccountService.getWithdrawalApplicationPageList(request));
    }

    /**
     * 商户提现申请审核
     *
     */
    @PostMapping(value = "/reviewWithdrawalApplication")
    public CommonResult<EbWithdrawalApplication> reviewWithdrawalApplication(@RequestBody EbWithdrawalApplication ebWithdrawalApplication) {

        return CommonResult.success(splittingAccountService.reviewWithdrawalApplication(ebWithdrawalApplication));
    }
}
